Cleanup

The tutorial allocates a lot of OpenGL resources. It allocates a buffer object, which represents memory on the GPU. It creates two shader objects and a program object, all of which stored in memory owned by OpenGL. But it only deletes the shader objects; nothing else.

Part of this is due to the nature of FreeGLUT, which does not provide hooks for a cleanup function. But part of it is also due to the nature of OpenGL itself. In a simple example such as this, there is no need to delete anything. OpenGL will clean up its own assets when OpenGL is shut down as part of window deactivation.

It is generally good form to delete objects that you create before shutting down OpenGL. And you certainly should do it if you encapsulate objects in C++ objects, such that destructors will delete the OpenGL objects. But it is not strictly necessary.